/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entities;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author QUY-THI
 */
@Entity
@Table(name = "Labs")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Lab.findAll", query = "SELECT l FROM Lab l"),
    @NamedQuery(name = "Lab.findByLabID", query = "SELECT l FROM Lab l WHERE l.labID = :labID"),
    @NamedQuery(name = "Lab.findByLabname", query = "SELECT l FROM Lab l WHERE l.labname = :labname"),
    @NamedQuery(name = "Lab.findByCreateDate", query = "SELECT l FROM Lab l WHERE l.createDate = :createDate"),
    @NamedQuery(name = "Lab.findByDescription", query = "SELECT l FROM Lab l WHERE l.description = :description"),
    @NamedQuery(name = "Lab.findByStatus", query = "SELECT l FROM Lab l WHERE l.status = :status")})
public class Lab implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy=GenerationType.IDENTITY)
    @Column(name = "LabID")
    private Integer labID;
    @Basic(optional = false)
    @Column(name = "Labname")
    private String labname;
    @Column(name = "CreateDate")
    @Temporal(TemporalType.TIMESTAMP)
    private Date createDate;
    @Column(name = "Description")
    private String description;
    @Column(name = "Status")
    private Boolean status;
    @OneToMany(mappedBy = "labID")
    private List<Device> deviceList;
    @OneToMany(mappedBy = "labID")
    private List<TimeTable> timeTableList;

    public Lab() {
    }

    public Lab(Integer labID) {
        this.labID = labID;
    }

    public Lab(Integer labID, String labname) {
        this.labID = labID;
        this.labname = labname;
    }

    public Integer getLabID() {
        return labID;
    }

    public void setLabID(Integer labID) {
        this.labID = labID;
    }

    public String getLabname() {
        return labname;
    }

    public void setLabname(String labname) {
        this.labname = labname;
    }

    public Date getCreateDate() {
        return createDate;
    }

    public void setCreateDate(Date createDate) {
        this.createDate = createDate;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public Boolean getStatus() {
        return status;
    }

    public void setStatus(Boolean status) {
        this.status = status;
    }

    @XmlTransient
    public List<Device> getDeviceList() {
        return deviceList;
    }

    public void setDeviceList(List<Device> deviceList) {
        this.deviceList = deviceList;
    }

    @XmlTransient
    public List<TimeTable> getTimeTableList() {
        return timeTableList;
    }

    public void setTimeTableList(List<TimeTable> timeTableList) {
        this.timeTableList = timeTableList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (labID != null ? labID.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Lab)) {
            return false;
        }
        Lab other = (Lab) object;
        if ((this.labID == null && other.labID != null) || (this.labID != null && !this.labID.equals(other.labID))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entities.Lab[ labID=" + labID + " ]";
    }
    
}
